const request = require('request');
const express = require('express');
const router = express.Router();
const Mock = require('mockjs');

router.get('/list', (req, res, next) => {
    let data = Mock.mock({
        resultCode: 200,
        resultJson: {
            'id|1-20000': 10000,//id: 10000-20000之间的随机一个数字
            'title': '@title()',//name: 随机生成一个中文名
        },
        resultMessage: '查询成功'
    });
    res.json(data)
});

router.get("/detail", (req, res, next) => {
	console.log(req)
  let data = Mock.mock({
    resultCode: 200,
    resultJson: {
			'title': '@title()',
      id: req.query.id, //id: 10000-20000之间的随机一个数字
      paragraph: "@paragraph(1, 5)", //name: 随机生成一个中文名
      images: "@image('200x100', '#409eff', Mock.js')" //image:
    },
    resultMessage: "查询成功"
  });
  res.json(data);
});
module.exports = router;